# coding:utf-8

from django.template import loader, Context
from django.http import HttpResponse
from django.shortcuts import render_to_response
from poster.models import blog

def home(request):
    blog_list = blog.objects.all().order_by('-create_time')
    t = loader.get_template('index.html')
    c = Context({'blog_list':blog_list,
                 })
    return HttpResponse(t.render(c))
def detail(request,param1):
    poster = blog.objects.get(title_en=param1)
    poster.n_views = poster.n_views+1
    poster.save()
    t = loader.get_template('detail.html')
    c = Context({'poster':poster,
                 })
    print param1
    return HttpResponse(t.render(c))
